package com.mida.bms.report.process.impl;

import com.mida.bms.report.entity.DocStructReport;
import com.mida.bms.report.process.DocFastWriteProcess;
import com.mida.bms.report.service.DocFastWriteService;
import com.mida.bms.report.vo.PatientInfoParameterVo;
import com.mida.tool.common.massert.MAssert;
import com.mida.tool.common.result.ListResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.mida.tool.common.result.BaseResult.buildListSuccess;

/**
 * 快速写入相关处理
 */
@Service
@Slf4j
public class DocFastWriteProcessImpl implements DocFastWriteProcess {

    @Autowired
    DocFastWriteService docFastWriteService;

    /**
     * 根据查询条件、查询患者历史报告列表
     * @param vo
     * @return
     * @throws Exception
     */
    @Override
    public ListResult<List<DocStructReport>> gainHistoryReportList(
            PatientInfoParameterVo vo) throws Exception {
        ListResult listResult = new ListResult();
        Map<String, Object> map = new HashMap<String, Object>();
        List<Long> listExamType = new ArrayList<Long>();
        listExamType.add(Long.valueOf(vo.getExamServiceTypeSoid()));
        map.put("listExamType", listExamType);
        map.put("apntPersonSoid", vo.getApntPersonSoid());
        map.put("status", vo.getStatus());
        map.put("beginDate", vo.getBeginDate());
        map.put("endDate", vo.getEndDate());
        map.put("visitScenceCode", vo.getVisitScenceCode());

        List<DocStructReport> listDocStructReport =
                docFastWriteService.gainHistoryReportList(map);

        buildListSuccess(listResult, listDocStructReport);
        return listResult;
    }
}
